package com.movie.ticket.sale.assembly.mapper;



import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.movie.ticket.sale.assembly.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.movie.ticket.sale.assembly.entity.Vip;
import com.movie.ticket.sale.pram.CinemaVip;
import com.movie.ticket.sale.pram.ComplainPram;
import com.movie.ticket.sale.pram.OrderPram;
import com.movie.ticket.sale.pram.UserPram;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author muzi
 * @since 2020-12-07
 */
public interface UserMapper extends BaseMapper<User> {
       void changeUsers(UserPram userPram);
       @Select("select  o.id ,o.status,o.statu, trade_nuo, m.name as movieName , c.name as cinemaName," +
               " a.type,a.name as auditoriumName, p.id,o.real_price,o.ticket_price,o.tip,o.number,o.refund," +
               "o.change_times as changeTime,o.create_time,o.state from t_order_movie o  join t_cinema c join t_auditorium a join t_perid p join t_movie m on o.cinema_id = c.id and " +
               "o.movie_id = m.id and o.auditorium_id =a.id and o.perid_id = p.id WHERE o.user_id = #{userId} order by o.create_time DESC")
       IPage<OrderPram> findUserOrder(Page page, @Param("userId") Integer userId);
       @Select("select c.id , c.cinema_name,c.address from t_cinema c join t_vip v  on c.id = v.cinema_id where c.state = 2  ")
       IPage<CinemaVip> findCinemaVip(Page page);
       @Select("select n.id,n.content,c.cinema_name  from t_complain n join t_cinema c on n.cinema_id = c.id where n.user_id = #{userId} and n.state = 1")
       IPage<ComplainPram> findUserComplain(Page page, @Param("userId")int userId);
       @Select("select * from t_vip where state = 1")
       IPage<Vip> findVips(Page page);
}
